package liany.xk.controller;

import liany.xk.common.ViewResult;
import liany.xk.model.SysUser;
import liany.xk.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
public class LoginController {
    @Autowired
    private SysUserService sysUserService;
    @RequestMapping(value = "/getLogin",method = RequestMethod.POST)
    public ResponseEntity<ViewResult<SysUser>> selectByUserName(String username, String password){
        if(sysUserService.selectByUserName(username,password)){
            return new ResponseEntity("登录成功",HttpStatus.OK);
        }else{
            return new ResponseEntity("登录失败",HttpStatus.OK);
        }
    }
}
